package keter.starter.demo.config;

import keter.starter.service.DemoProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Collection;


/**
 * 等待DemoAutoConfiguration中的AnnotationServiceDiscoverer初始化完成
 */
@Configuration
@AutoConfigureAfter(DemoAutoConfiguration.class)
public class DemoServiceAutoConfiguration {

    @Autowired
    DemoProcessor processor;

    /**
     * 使注解功能生效
     * @return
     */
    @ConditionalOnMissingBean
    @Bean
    public Collection process() {
        return processor.process();
    }
}
